package com.ruoyi.iot.dataprocessing.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 设备消息对象 sensor_message
 * 
 * @author luogongquan
 * @date 2024-08-26
 */
public class SensorMessage extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键 */
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    /** 用户id */
    @Excel(name = "用户id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long customerId;

    /** 设备id */
    @Excel(name = "设备id")
    //@JsonFormat(shape = JsonFormat.Shape.STRING)
    private String deviceNo;



    /** 消息开始时间 */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "消息开始时间", width = 30, dateFormat = "yyyy-MM-dd  HH:mm:ss")
    private Date tsStart;

    /** 消息结束时间 */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Excel(name = "消息结束时间", width = 30, dateFormat = "yyyy-MM-dd  HH:mm:ss")
    private Date tsEnd;

    /** 消息体 */
    @Excel(name = "消息体")
    private String messageStr;

    private byte[] message;

    /** $column.columnComment */
    @Excel(name = "设备类型", readConverterExp = "")
    private Integer deviceType;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setCustomerId(Long customerId) 
    {
        this.customerId = customerId;
    }

    public Long getCustomerId() 
    {
        return customerId;
    }

    public String getDeviceNo() {
        return deviceNo;
    }

    public void setDeviceNo(String deviceNo) {
        this.deviceNo = deviceNo;
    }

    public void setTsStart(Date tsStart)
    {
        this.tsStart = tsStart;
    }

    public Date getTsStart() 
    {
        return tsStart;
    }
    public void setTsEnd(Date tsEnd)
    {
        this.tsEnd = tsEnd;
    }

    public Date getTsEnd() 
    {
        return tsEnd;
    }
    public void setMessage(byte[] message)
    {
        this.message = message;
    }

    public byte[] getMessage()
    {
        return message;
    }
    public void setDeviceType(Integer deviceType)
    {
        this.deviceType = deviceType;
    }

    public Integer getDeviceType()
    {
        return deviceType;
    }

    public String getMessageStr() {
        if(message!=null && message.length>0){
            return new String(message);
        }
        return messageStr;
    }

    public void setMessageStr(String messageStr) {
        this.messageStr = messageStr;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("customerId", getCustomerId())
            .append("deviceNo", getDeviceNo())
            .append("tsStart", getTsStart())
            .append("tsEnd", getTsEnd())
            .append("message", getMessage())
            .append("createTime", getCreateTime())
            .append("deviceType", getDeviceType())
            .toString();
    }
}
